package com.wlr.study.leetcode;

public class LeetCode26 {
    public static int removeDuplicates(int[] nums) {
        int i = 0, j = 1;
        while (j < nums.length) {
            if (nums[i]!=nums[j]){
                nums[i+1]=nums[j];
                i++;
            }
            j++;
        }
        return i+1;
    }

    public static void main(String[] args) {
        System.out.println(LeetCode26.removeDuplicates(new int[]{1, 1, 2}));
    }
}
